package Heist::AST::Root;

use strict;
use warnings;

sub new {
  bless {
    subnodes => [],
  }, shift;
}

sub last_subnode {
  my ($this) = @_;
  $this->{subnodes}->[-1];
}

package Heist::AST::Content;

use strict;
use warnings;

sub new {
  my ($class, $text) = @_;
  bless {
    text => $text,
  }, $class;
}

sub text {
  my ($this) = @_;
  $this->{text};
}

package Heist::AST::CodeLines;

use strict;
use warnings;

sub new {
  my ($class, $code) = @_;
  bless {
    code => $code,
  }, $class;
}

sub code : lvalue {
  my ($this) = @_;
  $this->{code};
}

package Heist::AST::Method;

use strict;
use warnings;

sub new {
  my ($class,
      $pre_identifier_whitespace,
      $method_name,
      $pre_argument_list_whitespace,
      $argument_list,
      $pre_tag_close_whitespace,
      ) = @_;
  bless {
      pre_identifier_whitespace    => $pre_identifier_whitespace,
      method_name                  => $method_name,
      pre_argument_list_whitespace => $pre_argument_list_whitespace,
      argument_list                => $argument_list,
      pre_tag_close_whitespace     => $pre_tag_close_whitespace,
      subnodes                     => [],
  }, $class;
}

sub pre_identifier_whitespace : lvalue {
  my ($this) = @_;
  $this->{pre_identifier_whitespace};
}

sub method_name : lvalue {
  my ($this) = @_;
  $this->{method_name};
}

sub pre_argument_list_whitespace : lvalue {
  my ($this) = @_;
  $this->{pre_argument_list_whitespace};
}

sub argument_list : lvalue {
  my ($this) = @_;
  $this->{argument_list};
}

sub pre_tag_close_whitespace : lvalue {
  my ($this) = @_;
  $this->{pre_tag_close_whitespace};
}

sub last_subnode : lvalue {
  my ($this) = @_;
  $this->{subnodes}->[-1];
}

package Heist::AST::ExpressionTag;

use strict;
use warnings;

sub new {
  my ($class, $code, $filters) = @_;
  bless {
    code    => $code,
    filters => $filters,
  }, $class;
}

sub code : lvalue {
  my ($this) = @_;
  $this->{code};
}

package Heist::AST::CodeTag;

use strict;
use warnings;

sub new {
  my ($class, $code) = @_;
  bless {
    code => $code,
  }, $class;
}

sub code : lvalue {
  my ($this) = @_;
  $this->{code};
}

package Heist::AST::OutputStart;

use strict;
use warnings;

sub new {
  bless {}, shift;
}

package Heist::AST::OutputStop;

use strict;
use warnings;

sub new {
  bless {}, shift;
}

package Heist::AST::IgnoredContent;

use strict;
use warnings;

sub new {
  my ($class, $text) = @_;
  bless {
    text => $text,
  }, $class;
}

sub text : lvalue {
  my ($this) = @_;
  $this->{text};
}

1;
